home *** CD-ROM | disk | FTP | other *** search
- unit TstPropU;
-
- interface
-
- uses
- WinProcs, WinTypes, Messages, SysUtils, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, ExtCtrls, DBCtrls;
-
- type
- TForm1 = class(TForm)
- Panel1: TPanel;
- ComboBox1: TComboBox;
- Button1: TButton;
- DBNavigator1: TDBNavigator;
- procedure Button1Click(Sender: TObject);
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- uses
- TypInfo;
-
- function IsPropPublished(AClass: TClass;
- const PropName: String): Boolean;
- begin
- Result := GetPropInfo(AClass.ClassInfo, PropName) <> nil
- end;
-
- procedure TForm1.Button1Click(Sender: TObject);
- const
- MsgYes = '%s looks good';
- MsgNoGood = '%s is not based on a TCustomPanel';
- MsgNearly = '%s doesn''t have it published';
- var
- Loop: Integer;
- begin
- for Loop := 0 to Pred(ComponentCount) do
- if Components[Loop] is TCustomPanel then
- if IsPropPublished(Components[Loop].ClassType, 'BevelInner') then
- ShowMessage(Format(MsgYes, [Components[Loop].Name]))
- else
- ShowMessage(Format(MsgNearly, [Components[Loop].Name]))
- else
- ShowMessage(Format(MsgNoGood, [Components[Loop].Name]))
- end;
-
- end.
-